package com.ceo.common.protocol;

/**
 * @author uto_dev_008
 * @desc 系统异常码划分规则:
 * 2位系统号+2位模块号+4位序号，例如：10101000
 * <p>
 * @since 2021/11/22 15:48
 * Copyright (c)  All rights reserved
 */
public enum PlatformErrorCode {
    //此非错误码,占位用
    SYS_OK(0, "成功"),
    // 平台通用异常码以1000000开头
    SYS_ERROR(1, "系统错误"),
    RESOURSE_MISS_ERROR(10000001, "[%s]资源缺失"),
    SYS_DB_OPER_ERROR(10000002, "数据库操作失败"),
    SYS_PARAM_NULL(10000003, "关键参数错误"),
    UNKNOWN_ERROR(10000004, "未知错误,请联系管理员"),
    OPERATOR_ERROR(10000005, "对象操作异常"),
    TOKEN_ERROR(10000006, "认证信息验证失败"),
    DUPLICATEKEY_ERROR(10000007, "重复数据提交"),
    MAXUPLOADSIZE_ERROR(10000008, "文件超过大小"),
    HTTPMEDIATYPENOTSUPPORTED_ERROR(10000009, "请求Content-type不支持"),
    HTTPMESSAGENOTREADABLE_ERROR(10000010, "post请求未传参数"),
    HTTPREQUESTMETHODNOTSUPPORTED_ERROR(10000010, "post请求未传参数");



    private int code;

    private String alias;

    private String message;

    //注意, message默认使用i18文件中的message
    PlatformErrorCode(Integer code, String alias) {
        this.code = code;
        this.message = alias;
    }

    PlatformErrorCode(Integer code) {
        this.code = code;
    }

    public int getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }
}
